﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace hello_accinv_New_
{
    class CustomDateTime
    {
        public static string GetCurrentDate()
        {
            string date = DateTime.Today.ToShortDateString();
            string[] split = date.Split('/');
            return (Int32.Parse(split[2]) - 543) + "-" + ((split[1].Length == 1) ? "0" : "") + split[1] + "-" + ((split[0].Length == 1) ? "0" : "") + split[0];
        }

        public static string GetCurrentTime()
        {
            return DateTime.Now.ToLongTimeString();
        }

        public static string ToSqlDate(string dt)
        {
            string[] split = dt.Split('/');
            return split[2] + "-" + ((split[0].Length == 1) ? "0" : "") + split[0] + "-" + ((split[1].Length == 1) ? "0" : "") + split[1];
        }

        public static string ToSqlDate(DateTime dt)
        {
            string dt_str = dt.ToShortDateString();
            string[] split = dt_str.Split('/');
            return split[2] + "-" + ((split[0].Length == 1) ? "0" : "") + split[0] + "-" + ((split[1].Length == 1) ? "0" : "") + split[1];
        }
    }
}
